package de.vogella.mysql.first;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * teste.java
 *
 * Created on 8 janv. 2012, 15:15:35
 */


/**
 *
 * @author Marouane
 */
import java.sql.*;
import java.util.HashMap;
import java.util.Map;
import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;


import javax.swing.*;
import java.net.*;
import javax.media.*;

import java.io.*;
import java.awt.*;
public class teste extends javax.swing.JFrame {
   

    /** Creates new form teste */
    public teste() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jTextField1 = new javax.swing.JTextField();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setBounds(new java.awt.Rectangle(0, 0, 2000, 2000));
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowOpened(java.awt.event.WindowEvent evt) {
                formWindowOpened(evt);
            }
        });

        jTextField1.setText("jTextField1");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 1195, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 1577, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

private void formWindowOpened(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowOpened
        try {
            
         /* Connection c = Main.connect();
          Statement st = c.createStatement();
          ResultSet rs = st.executeQuery("select pathv from video");
          
             while (rs.next()) {
               URL sss = rs.getURL("pathv"); 
               SimplePalyer simpleplayer = new SimplePalyer("Match Rugby",sss);
	       simpleplayer.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
               simpleplayer.setBounds(200, 30, 1000, 500);
               
               simpleplayer.setVisible(true);
	       }
             
               
               //t1.setText(ss);
               
            // nott = rs.getString("round(avg(nvl(notee,0)),2)");*/
               
               JFileChooser chooser = new JFileChooser();
		int option = chooser.showOpenDialog(null);
		if(option == JFileChooser.APPROVE_OPTION) {
			try {
				
				URL url = chooser.getSelectedFile().toURL();
                                System.out.print(url);
                                SimplePalyer simpleplayer = new SimplePalyer("simple media player app", url);
                                simpleplayer.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                                simpleplayer.setSize(300,400);
                                simpleplayer.setVisible(true);
                                
				
				
			}catch(MalformedURLException ex){
				System.out.println("The url was malformed");
                                
				
			}
			
			} // end main
		
            
                
            
        } catch (Exception ex) {
            ex.printStackTrace();        }
    
    
			
		
		
    
    

}//GEN-LAST:event_formWindowOpened

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(teste.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(teste.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(teste.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(teste.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new teste().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTextField jTextField1;
    // End of variables declaration//GEN-END:variables
}
